package test4_15.demo01;

class test4 {
    public static void main(String[] args) {

        System.out.println("开始");

        Four one1 = new Four();


        new Thread(() -> one1.getOne()).start();
        new Thread(() -> one1.getTwo()).start();
        new Thread(() -> one1.getThree()).start();

    }
}


public class Four {

    public synchronized void getOne() {

        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }

        System.out.println("=====1=====");
    }

    public synchronized void getTwo() {
        System.out.println("=====2=====");
    }

    public void getThree() {
        System.out.println("=====3=====");
    }

}
